package org.jackysoft.util;

import java.util.Set;

import com.google.common.collect.Sets;

public abstract class AbstractRowWatcher implements RowWatcher {

	private Set<String> errors = Sets.newHashSet();

	private String sheetKey;

	@Override
	public Set<String> getErrors() {
		return errors;
	}

	public String appendError(String error, Object... args) {
		String msg = String.format(error, args);
		this.errors.add(msg);
		return msg;
	}

	/**
	 * @return true 有错误 false 无错误
	 * 
	 * */
	public boolean hasError() {
		return this.getErrors().size() != 0;
	}

	@Override
	public String getSheetKey() {
		return this.sheetKey;
	}

	@Override
	public void setSheetKey(String key) {
		this.sheetKey = key;
	}

}
